package com.easy;

/**
 * Created by Lxk on 2019/7/13.
 */
public class Solution461 {
    public int hammingDistance(int x, int y) {
        int val = x^y;
        int count = 0;
        for(int i = 0;i <= 30; i++){
            if(1==(val&1)){
                count++;
            }
            val = val>>1;
        }
        return count;
    }

    public static void main(String[] args) {
        Solution461 solution461 = new Solution461();
        System.out.println(solution461.hammingDistance(1,4));
    }
}
